package com.hl.service;

import com.hl.mapper.ArticleMapper;
import com.hl.mapper.XinlidayiMapper;
import com.hl.mapper.ZixunshiPage;
import com.hl.pojo.Article;
import com.hl.pojo.Consultants;
import com.hl.pojo.Psychologicalqasessions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SearchServiceImpl implements SearchService {
    @Autowired
    private ArticleMapper articleMapper;
    @Autowired
    private ZixunshiPage zixunshiPage;
    @Autowired
    private XinlidayiMapper xinlidayiMapper;

    @Override
    public Map<String, List<?>> search(String keyword) {
        List<Article> list1 = articleMapper.searchArticle(keyword);
        List<Consultants> list2 = zixunshiPage.consultantsbylike(keyword);
        List<Psychologicalqasessions> list3 = xinlidayiMapper.searchPsychologicalqasessionsList(keyword);
        Map<String, List<?>> map = new HashMap<String, List<?>>();
        map.put("articles", list1);
        map.put("consultants", list2);
        map.put("psychologicalqasessions", list3);
        return map;
    }
}
